<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<title>Insert title here</title>
</head>
<body>
<div th:fragment="page">
	<div class="row" th:if="${page!=null && #lists.size(page.getRecords())>0}"
		 th:with="pages=${((page.total + page.size - 1) / page.size) <= 0 ? 1 : (page.total + page.size - 1) / page.size}">
		<div th:if="${pages <= 10 && page.size != 0 }" class="form-group col-md-11 pagination-centered">
			<ul class="pagination">
				<li class="pageLink" th:each="num : ${#numbers.sequence(1, pages)}"
					th:class="${page.current == num} ? 'page-item active'">
					<a class="pageLink" href="javascript:void(0);" th:onclick="'pagination('+${num}+')'"
					   th:text="${num}"></a>
				</li>
			</ul>
		</div>
		<div th:if="${pages > 10}" class="form-group col-md-11 pagination-centered">
			<ul class="pagination">
				<li class="pageLink" th:if="${page.current-3 >1}">
					<a class="pageLink" href="javascript:void(0);" th:onclick="'pagination('+${1}+')'">1..</a>
				</li>
				<li class="pageLink" th:if="${page.current-3 >1}">
					<a class="pageLink" href="javascript:void(0);"
					   th:onclick="'pagination('+${page.current-5}+')'"><<</a>
				</li>

				<li class="pageLink" th:if="${page.current+3 < pages}"
					th:each="num : ${#numbers.sequence(page.current-3 > 0 ? page.current-3 : 1, pages > page.current+3 ? page.current+3 : pages )}"
					th:class="${page.current == num} ? 'page-item active'"
				>
					<a class="pageLink" href="javascript:void(0);" th:onclick="'pagination('+${num}+')'"
					   th:text="${num}"></a>
				</li>

				<li class="pageLink" th:if="${page.current+3 >= pages}"
					th:each="num : ${#numbers.sequence(pages-5, pages)}"
					th:class="${page.current == num} ? 'page-item active'"
				>
					<a class="pageLink" href="javascript:void(0);" th:onclick="'pagination('+${num}+')'"
					   th:text="${num}"></a>
				</li>

				<li class="pageLink" th:if="${page.current+3 < pages}">
					<a class="pageLink" href="javascript:void(0);"
					   th:onclick="'pagination('+${page.current+5}+')'">>></a>
				</li>
				<li class="pageLink" th:if="${page.current+5 < pages}">
					<a class="pageLink" href="javascript:void(0);" th:onclick="'pagination('+${pages}+')'">..[[${pages}]]</a>
				</li>
			</ul>
		</div>
	</div>
</div>
</body>
<script type="text/javascript" th:inline="javascript">
</script>
</html>